package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._1工厂模式._计算器4;


/**
 * @ClassName OperationFactory
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/9 11:16 PM
 * @Version 1.0
 */
public class OperationFactory {
    public static Operation createOperate(String strOperate) {
        Operation operation = null;
        switch (strOperate){
            case "+":
                operation=new Add();
                break;
            case "-":
                operation= new Sub();
                break;
            case "*":
                operation = new Mul();
                break;
            case "/":
                operation = new Div();
                break;
        }
        return operation;
    }
}
